package com.xuecheng.ucenter.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author Linzkr
 * @description: TODO
 * @date 2023/2/1 11:59
 */
@Component
@Slf4j
public class CheckCodeClientFactory implements FallbackFactory<CheckCodeClient> {
    @Override
    public CheckCodeClient create(Throwable throwable) {


        return new CheckCodeClient() {
            @Override
            public Boolean verify(String key, String code) {
                log.info("调用验证码服务熔断异常：{}",throwable.getMessage());
//                注意 这里不要返回FALSE 或者true因为要与正常的流程区分开
                return null;
            }
        };
    }
}
